#coding=utf-8
'''
Created on 2017-6-17

@author: sandy
'''

from pycommon import const
from pycommon import packet
from pycommon import utils

def loginManager(errorcode):
    return packet.pack("HH",const.CMD_MGR2XX_LOGIN_RET,errorcode)


def sendConfig(cfgName,cfg):
    return packet.pack("HsS",const.CMD_MGR2XX_REMOTE_CFG,utils.u2pstr(cfgName),cfg)

def sendConfigFin():
    return packet.pack("H",const.CMD_MGR2XX_REMOTE_CFG_FIN)

def uploadFile(cfgName,codeStr):
    return packet.pack("Hss",const.CMD_MGR2XX_UPLOAD_FILE_RET,cfgName,codeStr)

def hotUpdateFile(cfgName,md5str,content):
    return packet.pack("HssS",const.CMD_MGR2XX_REMOTE_PATCH,cfgName,md5str,content)

def hotUpdateFileRet(cfg,codeStr):
    return packet.pack("Hss",const.CMD_MGR2XX_HOT_UPDATE_FILE,cfg,codeStr)